#include "random_generator.h"
#include <chrono>

namespace base
{
namespace utils
{
RandomGenerator::RandomGenerator()
{
  //使用高精度的纳秒，避免执行太快导致种子相同的情况
  engine_.seed(std::chrono::high_resolution_clock::now().time_since_epoch().count());
}
int RandomGenerator::randInt(int min, int max)
{
  std::uniform_int_distribution<int> uniform(min, max);
  return uniform(engine_);
}
double RandomGenerator::randReal(double min, double max)
{
  std::uniform_real_distribution<double> uniform(min, max);
  return uniform(engine_);
}

}
}

